package edu.zut.controller;

import edu.zut.service.EmpService;
import edu.zut.service.impl.EmpServiceImpl;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "EmpDeleteServlet", value = "/emp/delete")
public class EmpDeleteServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int id = Integer.parseInt(request.getParameter("id"));
        //调用service对应的删除操作
        EmpService empService = new EmpServiceImpl();
        int i = empService.deleteEmpById(id);
        response.sendRedirect(request.getContextPath() + "/emp/show");
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
